//
//  IOTCGame.h
//  2048-cleanModel
//
//  Created by User-16 on 4/8/14.
//  Copyright (c) 2014 IOTrainingCamp. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NumberView.h"

typedef enum {
    LEFT, DOWN, RIGHT, UP
}MoveDirection;

typedef enum {
    LOOSE, WIN
}GameEndReason;

@protocol IOTCGameDelegate <NSObject>

// in index paths row mean the row of the tile and section is the col
-(void) updateTileAtIndex:(NSIndexPath*) index;
-(void) gameOverWithReason:(GameEndReason) reason;

@optional
-(void) moveNumberViewAtIndex:(NSIndexPath*) fromIndex toIndex:(NSIndexPath*) toIndex;
-(void) moveNumberViewWithAdditionFromIndex:(NSIndexPath*) fromIndex toIndex:(NSIndexPath*) toIndex;
-(void) newTileSpawnAtIndex:(NSIndexPath*)index;

@end

@interface IOTCGame : NSObject

@property CGPoint size;
@property (weak) id<IOTCGameDelegate> delegate;
@property (readonly) unsigned long score;

+(id)sharedInstance;
-(void) loadANewGameWithSize:(CGPoint) size;
-(void) moveInDirection:(MoveDirection) direction;
-(NumberView*) numberViewForIndexPath:(NSIndexPath*) index;
-(void) updateBoard;

@end
